package rmi.r17;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class ZwierzeTester {

	public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {

		Zwierze z = new Pies("Azorek");
		Kot k = new Kot("Mruczek");
		
		File plik = new File("zwierzaki.ser");
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(plik));
		oos.writeObject(z);
		oos.writeObject(k);
		oos.close();
		
		System.out.println("Zapisano.");
		
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream(plik));
		((Zwierze) (ois.readObject())).dajGlos();
		System.out.println(((Kot) (ois.readObject())).getImie());
		ois.close();
	}

}
